﻿using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace RazorPageSample.Infrastructure.Filters
{
    public class PageFilterAttribute
        : Attribute, IPageFilter
    {
        private readonly ILogger<PageFilterAttribute> _logger;
        public PageFilterAttribute(ILogger<PageFilterAttribute> logger)
        {
            _logger = logger;
        }
        public void OnPageHandlerExecuted(PageHandlerExecutedContext context)
        {
            _logger.LogInformation("executed");
        }

        public void OnPageHandlerExecuting(PageHandlerExecutingContext context)
        {
            _logger.LogInformation("executing");
        }

        public void OnPageHandlerSelected(PageHandlerSelectedContext context)
        {
            _logger.LogInformation("selected");
        }
    }
}
